<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <title>后台管理系统 - 登录</title>

    <link rel="shortcut icon" th:href ="@{/static/favicon.ico}"/>
    <link th:href ="@{/static/css/bootstrap.min.css?v=3.3.6}" rel="stylesheet"/>
    <link th:href ="@{/static/css/font-awesome.css?v=4.4.0}" rel="stylesheet"/>
    <link th:href ="@{/static/css/animate.css}" rel="stylesheet"/>
    <link th:href ="@{/static/css/style.css?v=4.1.0}" rel="stylesheet"/>
    <script>if (window.top !== window.self) {
        window.top.location = window.location;
    }</script>
    <script th:src="@{/static/js/jquery.min.js?v=2.1.4}"></script>
    <script th:src="@{/static/js/bootstrap.min.js?v=3.3.6}"></script>
    <style>
    	h1{
    		margin-top:0;
    	}
	    .logo-name{
	    	font-size: 40px !important;
	    	letter-spacing: 0px;
	    	font-family: 微软雅黑;
	    }
    	.loginscreen.middle-box {
		    width: auto;
		    background-color: #33333347;
		    height:100%;
		}
		form{
		    background: #95959566;
		    width: 360px;
		    margin: 0 auto;
		    border-radius: 5px;
		    overflow: hidden;
		}
		form h3{
		    height: 50px;
		    line-height: 50px;
		    background-color: #008cff;
		    color: #fff;
		    margin-top:0;
		    letter-spacing: 1.5px;
		}
		.userinfo{
			padding: 15px 30px 30px 30px;
		}
		.userinfo input,.userinfo button{
			height:40px;
		}
    </style>
</head>

<body class="gray-bg">
<div style="position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;">
	<img th:src="@{/static/img/bj.jpg}" style="width: 100%;height: 100%"/>        <!-- ;filter: blur(20px); -->
</div>
<div class="middle-box text-center loginscreen  animated fadeInDown">
	<div style="float:left"><img th:src="@{/static/img/log.png}" style="width: 500px;height: 150px"/></div>
    <div style="position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-70%);">
        <div>
            <h1 class="logo-name">欢迎使用后台管理系统 </h1>
            <h2 class="logo-name" style="font-size: 35px;">城基生态</h2>
        </div>
        
        <br/>
        <!-- <h4 style="color: red;">${tips!}</h4> -->
       <form class="m-t" role="form" action="" method="post" id="loginForm"> 
            <h3>欢迎使用后台管理系统</h3>
            <div class="userinfo">
	            <div class="form-group">
	                <input type="text" name="username" class="form-control" placeholder="用户名" required=""/>
	            </div>
	            <div class="form-group">
	                <input type="password" name="password" class="form-control" placeholder="密码" required=""/>
	            </div>	           
	            <button type="button" class="btn btn-primary block full-width m-b" onclick="login()">登 录</button>
	             <button type="button" style="display:none;" class="btn btn-primary block full-width m-b" id="submitBtn">登 录</button>
            </div>            
      </form> 
    </div>
</div>
<script>
	document.onkeydown = function(e){
    	if(e.keyCode == 13){
    		login();
    	}
	}

	 function login(){
		$.ajax({
			url:"/login/checklogin",
			type:"post",
			success:function(data){
				if(!data){				
					$("#loginForm").submit();
				}else{
					var flag = window.confirm("系统检测到您未退出登录，如需切换用户，进入首页点击退出即可");
					if(flag){
						window.location.href="/index";						
					}
				}
			},
			error:function(err){
				console.log(err);
			}
		}); 
	}
	
</script>

</body>

</html>
